//
//  NSDate+YYFramework.m
//  p2p
//
//  Created by mokai on 14-8-29.
//  Copyright (c) 2014年 cloudyoo. All rights reserved.
//

#import "NSDate+zframework.h"

@implementation NSDate (zframework)

- (NSInteger)year{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSYearCalendarUnit)
                                                fromDate:self];
    return [comps year];
}

- (NSInteger)month{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSMonthCalendarUnit)
                                                fromDate:self];
    return [comps month];
}

- (NSInteger)day{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSDayCalendarUnit)
                                                fromDate:self];
    return [comps day];
}

- (NSInteger)hour{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSHourCalendarUnit)
                                                fromDate:self];
    return [comps hour];
}

- (NSInteger)minute{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSMinuteCalendarUnit)
                                                fromDate:self];
    return [comps minute];
}

- (NSInteger)second{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSSecondCalendarUnit)
                                                fromDate:self];
    return [comps second];
}

- (NSInteger)week{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSWeekCalendarUnit)
                                                fromDate:self];
    return [comps week];
}
- (NSInteger)weekday{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *comps =comps =[calendar components:(NSWeekdayCalendarUnit)
                                                fromDate:self];
    return [comps weekday];
}


@end
